import React from 'react';
import {connect} from 'react-redux';
import {Tabs} from 'antd';
import {messages} from "share/common";
const TabPane = Tabs.TabPane;

import NotificationContent from "containers/setting/notification-setting/notification-content/notification-content"
import NotificationRule from "containers/setting/notification-setting/notification-rule/notification-rule"
class NotificationSetting extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      tab: 'content',
    };
  }

  componentWillMount() {

  }


  onTabChange = (tab) => {
    this.setState({
      tab,
    },() => {
      if (tab === 'content') {

      } else {

      }
    })
  };

  render() {
    const {tab} = this.state;
    return (
      <div className="budget-organization">
        <Tabs type="card" activeKey={tab} onChange={this.onTabChange}>
          <TabPane tab={messages('setting.key1592')/*消息内容*/} key='content' />
          <TabPane tab={messages('setting.key1566')/*提醒规则*/} key='rule' />
        </Tabs>
        <div>
          {tab === 'content'&&(
            <NotificationContent/>
          )}
          {tab === 'rule'&&(
            <NotificationRule/>
          )}
        </div>
      </div>
    )
  }

}

NotificationSetting.contextTypes = {
  router: React.PropTypes.object
};

function mapStateToProps(state) {
  return {
    tenantMode: state.main.tenantMode,
  }
}

export default connect(mapStateToProps)(NotificationSetting);
